<?php
/**
 * Created by PhpStorm.
 * User: tengwei
 * Date: 2018/11/16
 * Time: 10:17 AM
 */

namespace common\sources\read\bank;

use common\models\craftsman\BuyUserBankAccount;

class BankAccess implements IBankAccess
{
    public function getBank($param)
    {
        // TODO: Implement getBank() method.
        return BuyUserBankAccount::find()
            ->select('real_name,idcard')
            ->where(['bankphone' => $param['bankphone']])
            ->asArray()
            ->one();
    }
    public function getBuyUserBankAccount($buy_id)
    {
        return BuyUserBankAccount::find()
                ->select('id,real_name,bankname,cardnum,idcard,status,buy_id,pro_name,pro_code,city_name,city_code,bankbranch,bankphone,AliPay,aliUrl,bankCardUrl,idCardUrl,reason,id_positive_url,id_verso_url')
                ->where(['buy_id'=>$buy_id])
                ->asArray()
                ->one();
    }
    public function getBuyUserBankStatusAccount($buy_id)
    {
        return BuyUserBankAccount::find()
            ->select('id,real_name,bankname,cardnum,idcard,status,buy_id,pro_name,pro_code,city_name,city_code,bankbranch,bankphone,AliPay,aliUrl,bankCardUrl,idCardUrl,reason,id_positive_url,id_verso_url')
            ->where(['buy_id'=>$buy_id,"status" =>2])
            ->asArray()
            ->one();
    }
    //获取绑定信息
    public function getBuyUserBankById($bank_id){
        return BuyUserBankAccount::find()
            ->select('id,real_name,bankname,cardnum,idcard,status,buy_id,pro_name,pro_code,city_name,city_code,bankbranch,bankphone,AliPay,aliUrl,bankCardUrl,idCardUrl,reason,id_positive_url,id_verso_url')
            ->where(['id'=>$bank_id])
            ->asArray()
            ->one();
    }
}